Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show progress bar while loading registry #2617

Merged
merged 1 commit into from
Dec 26, 2018

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Dec 19, 2018

Problem

Refreshing the mod list in GUI involves two steps:

  1. Getting the new data from the server
  2. Updating the lists and filters

Step 2 can take several seconds. While it's happening, the window freezes, because the intensive processing is done on the GUI thread (whereas step 1 has a progress bar). The freeze also happens when switching instances and changing version compatibility.

Changes

Now while the mod list is loading, the processing takes place in a background thread, and the progress bar screen is shown with messages indicating which step we're on (helpful for identifying slow pieces!):

image

This keeps the UI responsive and assures the user that it hasn't crashed. When finished, the tab is hidden.

Side performance tweak

While implementing this, I found out that the slowest step is Registry.Available, with a typical run time of up to a few seconds (I thought it would be loading the data from the registry.json file).

Unrelated to the above changes, this function was always called at the end of a repo update, but that was just to generate an int return value that isn't even used most of the time. So now those functions return bool and just return true instead of calling Registry.Available, and calling code is updated to call Registry.Available when it's actually needed. This should slightly speed up refreshes in GUI.

@HebaruSan HebaruSan added Enhancement New features or functionality GUI Issues affecting the interactive GUI Pull request labels Dec 19, 2018
@politas politas merged commit cea8ac9 into KSP-CKAN:master Dec 26, 2018
politas added a commit that referenced this pull request Dec 26, 2018
@HebaruSan HebaruSan deleted the feature/load-progressbar branch December 26, 2018 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New features or functionality GUI Issues affecting the interactive GUI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants